<?php
$this->breadcrumbs=array(Lang::t('article.list.page.title'));
?>

<div class="page-nav text-right">
    <a href="<?php echo $this->generateJsonUrl; ?>" class="btn btn-default"><span class="glyphicon glyphicon-refresh"></span> <?php echo Lang::t('article.list.btn.generate.json'); ?></a>
    <a href="<?php echo $this->addNewUrl; ?>" class="btn btn-default"><span class="glyphicon glyphicon-plus"></span> <?php echo Lang::t('article.list.btn.add.new'); ?></a>
</div>

<?php $this->getFlashes(array('class'=>'alert alert-{status}')); ?>

<!--
<div class="alert alert-info"><?php echo Lang::t('article.list.form.note'); ?></div>
-->
<?php //$this->widget('AdvancedSearchWidget', array('formView' => '_search', 'model' => $model)); ?>

<?php
$dataProvider->pagination->pageSize=Yii::app()->request->getParam('pageSize_', 1000);
$this->widget('ext.extended.GridView', array(
    'id' => 'grid',
    'ajaxUpdate'=>false,
    'dataProvider' => $dataProvider,
    'filter' => $model,
    'rowHtmlOptionsExpression'=>implode('; ', array(
        //'$data->defaultImage="'.$this->imagesPath.'/product-default.png"',
        'array("id"=>"sort_".$data->id)'
    )),
    'htmlOptions'=>array(
        'class'=>'table-responsive',
    ),
    'itemsCssClass'=>'table table-hover',
    'columns' => array(
        array(
            'filterHtmlOptions'=>array('class'=>'id-filter'),
            'name' => 'id_',
            'value' => '$data->id',
            'htmlOptions' => array('class' => 'id-column'),
        ),
        array(
            'name' => 'parent_',
            'value'=>array($model, 'gridTitle'),
            'filter'=>$model->parentOption,
            'filterHtmlOptions'=>array('style'=>'text-align:left;'),
            'htmlOptions'=>array(
                'style'=>'text-align:left;',
            ),
        ),
        array(
            'name'=>'type_',
            'filter'=>$model->typeOption,
            'value'=>'$data->type',
            'htmlOptions'=>array(
                'style'=>'width:50px; text-align:center;',
            ),
        ),
        array(
            'name' => 'position_',
            'value' => '(int)$data->position',
            'filter'=>false,
            'htmlOptions'=>array(
                'style'=>'width:50px; text-align:center;',
            ),
        ),
        array(
            'name'=>'status_',
            'filter'=>$model->statusOption,
            'value'=>'$data->status',
            'htmlOptions'=>array(
                'style'=>'width:50px; text-align:center;',
            ),
        ),
        /*
        array(
            'header' => 'Publish',
            'type' => 'boolean',
            'value' => '$data->isPublish',
            'htmlOptions'=>array(
                'style'=>'width:50px; text-align:center;',
            ),
        ),*/
        array(
            'class' => 'CButtonColumn',
            'htmlOptions'=>array(
                'style'=>'width:100px; text-align:center;',
            ),
        ),
        /*
        array(
            'class' => 'CCheckBoxColumn',
            'selectableRows' => 2,
        ),*/
    ),
));
?>
<?php 
$this->widget('ext.widgets.ESortableGridView.SortableGridView', array(
    'selector'=>'#grid table tbody',
    'processingUrl'=>$this->createUrl('sort'),
    'params'=>array('parent'=>$model->parent_),
));
?>